import {ContentViewNoFooter} from '@/components/main/contentView'
import {ViewLeftNotFooter} from '@/components/main/viewLeft'
import useGlobalAPI from '@/hooks/useGlobalAPI'
import {
  CheckHistoryFixedParamMainViewNav,
  handle_currentDevInfo_by_route_params_currentDevInfo,
  CheckHistoryFixedParamViewLeft,
  getAllDevParams,
  CheckHistoryFixedParamMainViewEchart,
  FixedParamViewLeftNav,
} from './components'

export default defineComponent({
  name: 'device-checkHistory_fixedParam',
  setup() {
    let {route} = useGlobalAPI()

    onMounted(async () => {
      if (Object.keys(route.query).length > 0) {
        handle_currentDevInfo_by_route_params_currentDevInfo({
          devId: Number(route.query.devId),
          devName: route.query.devName as string,
        })
        getAllDevParams()
      }
    })
    return () => (
      <div class=" h-full flex">
        <ViewLeftNotFooter>
          {{
            nav: () => <FixedParamViewLeftNav></FixedParamViewLeftNav>,
            content: () => (
              <CheckHistoryFixedParamViewLeft></CheckHistoryFixedParamViewLeft>
            ),
          }}
        </ViewLeftNotFooter>
        <ContentViewNoFooter>
          {{
            nav: () => (
              <CheckHistoryFixedParamMainViewNav></CheckHistoryFixedParamMainViewNav>
            ),
            content: () => (
              <CheckHistoryFixedParamMainViewEchart></CheckHistoryFixedParamMainViewEchart>
            ),
          }}
        </ContentViewNoFooter>
      </div>
    )
  },
})
